#include <at89x52.h>
#define RCLK P1_5
#define SDATA P1_6
#define SCLK P1_7
extern unsigned char Tcount0;

void SendData(unsigned char Xdata,unsigned char Ydata)
{
unsigned char i;
RCLK=0;
for(i=0;i<8;i++)
{
SDATA=Xdata & 0x01;
SCLK=0;
SCLK=1;
Xdata=Xdata>>1;
}
for(i=0;i<8;i++)
{
SDATA=Ydata & 0x01;
SCLK=0;
SCLK=1;
Ydata=Ydata>>1;
}
RCLK=1;
}



void LedCircle()
{

int a[8]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
int b[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
int i,k;

Timer0Init();

while(1)
{
i=0;

while(i<7)
{
if(Tcount0==1)
{
SendData(a[i],b[0]);
i++;
Tcount0=0;
}

}



i=0;
while(i<7)
{
if(Tcount0==1)
{
SendData(a[7],b[i]);
i++;
Tcount0=0;
}
}


i=7;
while(i>0)
{
if(Tcount0==1)
{
SendData(a[i],b[7]);
i--;
Tcount0=0;
}
}



i=7;
while(i>0)
{
if(Tcount0==1)
{
SendData(a[0],b[i]);
i--;
Tcount0=0;
}
}



}

}
